 {

        var o = require("../UIManager/UISoundManager.js"), i = function () {
        };
        i.prototype = {
            ctor: function () {
                this._ip = 0, this._uesrId = 0, this._name = "", this._pic = "", this._sex = 0,
                    this._coin = 0, this._tableCoin = 0, this._friScore = 0, this._seatId = 0, this._state = "sit",
                    this._ting = 0, this._chiFromSeat = -1, this._pengFromSeat = [], this._gangFromSeat = [],
                    this._trustee = !1, this._standup_tiles = [], this._gang_tiles = [], this._peng_tiles = [],
                    this._chi_tiles = [], this._ting_tiles = [], this._drop_tiles = [], this._zhan_tiles = [],
                    this._flower_tiles = [], this._ting_result = [], this._kou_tiles = [], this._mao_tiles = [],
                    this._win_tiles = [], this._multiWinTiles = [], this._isWin = !1, this._isTableHost = !1,
                    this._absenceColor = -1, this._ting_actions = [], this._detailInfo = null, this._tingSelect = !1,
                    Global.notificationCenter.on(Global.eventName.GAME_PLAY_A_TILE, this._onLocalPlayTile.bind(this), this);
            },
            onDestroy: function () {
                Global.notificationCenter.offAll(this);
            },
            updatePlayerInfo: function (e) {
                if (console.log("updatePlayerInfo :", e), console.log(e), null != e) {
                    if (this._ip = e.ip || 0, this._uesrId = e.userId || 0, this._name = e.name || "",
                        this._pic = e.pic || "", this._sex = e.sex || 0, this._coin = e.coin || 0, this._tableCoin = e.tableCoin || 0,
                        this._seatId = e.seatId || 0, this._state = e.state || "sit", this._ting = e.ting || !1,
                        this._chiFromSeat = e.chiFromSeat || -1, this._pengFromSeat = e.pengFromSeat || [],
                        this._gangFromSeat = e.gangFromSeat || [], this._trustee = e.trustee || !1, this._standup_tiles = e.standup_tiles || [],
                        this._gang_tiles = e.gang_tiles || [], this._peng_tiles = e.peng_tiles || [], this._chi_tiles = e.chi_tiles || [],
                        this._ting_tiles = e.ting_tiles || [], this._drop_tiles = e.drop_tiles || [], this._zhan_tiles = e.zhan_tiles || [],
                        this._flower_tiles = e.flower_tiles || [], this._ting_result = e.ting_result || [],
                        this._kou_tiles = e.kou_tiles || [], this._mao_tiles = e.mao_tiles || [], this._win_tiles = e.win_tiles || [],
                        this._multiWinTiles = e.multiWinTiles || [], this._winDoubleCount = e.win_double_count || 0,
                        this._losePayBackCount = e.lose_returnBack_count || 0, this._standup_tiles.sort(this._sortFun.bind(this)),
                    this._state == Global.config.CONFIRM_LOOSE) {
                        var t = {
                            seatId: this._seatId
                        };
                        Global.notificationCenter.emit(Global.eventName.MSG_SHOW_CONFIRM_LOOSE, t);
                    }
                } else cc.error("PlayerModel updatePlayerInfo playerInfo = null");
            },
            playerSit: function (e) {
                this._isTableHost = 0 != e.isTableHost, this._uesrId = e.userId, this._seatId = e.seatId,
                    this._ip = e.ip, this._name = e.name, this._pic = e.pic, this._sex = e.sex, this._state = e.state;
            },
            setReady: function () {
                this._state = Global.config.playState.READY;
            },
            setSit: function () {
                this._state = Global.config.playState.SIT;
            },
            setState: function (e) {
                this._state = e;
            },
            setTrustee: function (e) {
                this._trustee = !0;
            },
            removeTrustee: function () {
                this._trustee = !1;
            },
            getTrustee: function () {
                return this._trustee;
            },
            updateTiles: function (e) {
                this._standup_tiles = e, this._standup_tiles.sort(this._sortFun.bind(this));
            },
            getStandup_tiles: function () {
                return this._standup_tiles;
            },
            getDrop_tiles: function () {
                return this._drop_tiles;
            },
            updatePengTiles: function (e) {
                this._peng_tiles = e;
            },
            getPeng_tiles: function () {
                return this._peng_tiles;
            },
            updateChiTiles: function (e) {
                this._chi_tiles = e;
            },
            getChi_tiles: function () {
                return this._chi_tiles;
            },
            updateGangTiles: function (e) {
                this._gang_tiles = e;
            },
            getGang_tiles: function () {
                return this._gang_tiles;
            },
            getPlayed_tiles: function () {
                return this._drop_tiles;
            },
            getMultiWinTiles: function () {
                return this._multiWinTiles;
            },
            sendTile: function (e) {
                this._standup_tiles.sort(this._sortFun.bind(this)), this._standup_tiles.push(e);
            },
            setAbsenceColor: function (e) {
                this._absenceColor = e, this._standup_tiles.sort(this._sortFun.bind(this));
            },
            getAbsenceColor: function () {
                return this._absenceColor;
            },
            getName: function () {
                return this._name;
            },
            getPic: function () {
                return this._pic;
            },
            getTableCoin: function () {
                return this._tableCoin;
            },
            updateScore: function (e) {
                this._tableCoin = e;
            },
            getFriScore: function () {
                return this._friScore;
            },
            updateFriScore: function (e) {
                this._friScore = e;
            },
            setTingActions: function (e) {
                null == e && (e = []), this._ting_actions = e;
            },
            getTingActions: function () {
                return this._ting_actions;
            },
            setTingResult: function (e) {
                null == e && (e = []), this._ting_result = e;
            },
            getTingResult: function () {
                return this._ting_result;
            },
            getHuTiles: function () {
                return this._win_tiles;
            },
            _sortFun: function (e, t) {
                if (this._absenceColor >= 0) {
                    var n = Math.floor(e / 10), o = Math.floor(t / 10);
                    return (n == this._absenceColor ? e + 100 : e) - (o == this._absenceColor ? t + 100 : t);
                }
                return e - t;
            },
            _onLocalPlayTile: function (e) {
                if (null == e && cc.error("PlayerModel _onLocalPlayTile data = null"), (r = e.seatId) == Global.tableModel.toLocalSeatIndex(this._seatId)) {
                    if (1 == Global.tableModel.isLockPlayTile()) return cc.error("standTileDownController _onLocalPlayTile 已经锁住出牌!"),
                        void Global.notificationCenter.emit(Global.eventName.GAME_HUANPAI_UNSELECT_ALL);
                    var t = !1, n = -1, o = -1;
                    this._standup_tiles.length > e.tileIndex && (n = e.tileIndex, this._standup_tiles.length != e.tileIndex + 1 && (t = !0,
                        o = this._standup_tiles[this._standup_tiles.length - 1]), this._standup_tiles.splice(e.tileIndex, 1),
                        this._drop_tiles.push(e.tileValue), this._standup_tiles.sort(this._sortFun.bind(this)));
                    var i = Global.tableModel.getRoomId(), a = Global.tableModel.getTableId(),
                        r = Global.tableModel.getSeatId();
                    if (0 == i || 0 == a) return void cc.error("TableController onClickCancelTrustee", "roomId = " + i + " tableId = " + a + " seatId = " + r);
                    Global.msgHandler.requestPlayTile(i, a, r, e.tileValue, this.getIsTingSelect()),
                        Global.tableModel.lockPlayTile();
                    var s = {
                        seatId: Global.config.SEAT_DOWN,
                        needSortAction: !0,
                        needInsertAction: t,
                        needInsertActionTile: o,
                        needInsertActionTileIndex: n,
                        refreshSeatId: e.seatId
                    };
                    Global.notificationCenter.emit(Global.eventName.GAME_REFRESH_STAND_TILE, s);
                }
            },
            playTile: function (e) {
                var t = e.seatId, n = Global.tableModel.toLocalSeatIndex(t),
                    i = Global.roomInfoModel.getPlayModel() == Global.config.playModel.ERREN ? 1 : 0;
                o.playTileSound(e.tile, this._sex, i);
                var a = function (t, n) {
                    if (t) {
                        var o = this._standup_tiles.indexOf(e.tile);
                        o >= 0 && this._standup_tiles.splice(o, 1);
                    }
                    n && this._drop_tiles.push(e.tile), Global.notificationCenter.emit(Global.eventName.GAME_REFRESH_STAND_TILE);
                }.bind(this);
                n == Global.config.SEAT_DOWN ? this.getTrustee() || this.isWin() || this.getIsTing() ? a(!0, !0) : (console.error("no playTile action"),
                this._standup_tiles && this._standup_tiles.length > 0 && (this._standup_tiles.length % 3 == 1 ? (console.log("playTile 这是正确的手牌数量"),
                e.reconnect && (console.log("playTile 这是重连，那张牌不在弃牌堆和手牌堆，所以要刷新弃牌"), a(!1, !0))) : (console.error("playTile 出现少牌的情况！:", this._standup_tiles.length),
                    a(!0, !0)))) : (this._standup_tiles.pop(), this._drop_tiles.push(e.tile)), this._standup_tiles.sort(this._sortFun.bind(this));
            },
            peng: function (e, t) {
                if (1 == t) {
                    if (e.reconnect || o.playPengSound(this._sex), Global.tableModel.toLocalSeatIndex(e.seatId) == Global.config.SEAT_DOWN) {
                        for (var n = 0; n < 2; n++) {
                            var i = this._standup_tiles.indexOf(e.pattern[0]);
                            this._standup_tiles.splice(i, 1);
                        }
                        Global.tableModel.unLockPlayTile();
                    } else this._standup_tiles.pop(), this._standup_tiles.pop();
                    this._peng_tiles.push(e.pattern);
                } else this._drop_tiles.pop(), Global.notificationCenter.emit(Global.eventName.GAME_REFRESH_ARROW, -1);
            },
            ting: function (e) {
                e.reconnect || o.playTingSound(this._sex), this.setIsTing(1), this.setTrustee();
            },
            chi: function (e, t) {
                if (1 == t) {
                    if (e.reconnect || o.playEatSound(this._sex), Global.tableModel.toLocalSeatIndex(e.seatId) == Global.config.SEAT_DOWN) {
                        for (var n = 0; n < e.pattern.length; n++) {
                            var i = e.pattern[n];
                            if (i != e.tile) {
                                var a = this._standup_tiles.indexOf(i);
                                this._standup_tiles.splice(a, 1);
                            }
                        }
                        Global.tableModel.unLockPlayTile();
                    } else this._standup_tiles.pop(), this._standup_tiles.pop();
                    this._chi_tiles.push(e.pattern);
                } else this._drop_tiles.pop(), Global.notificationCenter.emit(Global.eventName.GAME_REFRESH_ARROW, -1);
            },
            gang: function (e, t) {
                if (1 == t) {
                    for (var n = !1, i = 0; i < this._peng_tiles.length; i++) if (this._peng_tiles[i][0] == e.tile) {
                        this._peng_tiles.splice(i, 1), n = !0;
                        break;
                    }
                    var a = !1;
                    if (e.gang && 0 == e.gang.style ? (a = !0, e.reconnect || o.playDarkBarSound(this._sex)) : (a = !1,
                    e.reconnect || o.playBrightBarSound(this._sex)), Global.tableModel.toLocalSeatIndex(e.seatId) == Global.config.SEAT_DOWN) {
                        var r = 3;
                        1 == n ? r = 1 : 1 == a && (r = 4);
                        for (i = 0; i < r; i++) {
                            var s = this._standup_tiles.indexOf(e.gang.pattern[0]);
                            this._standup_tiles.splice(s, 1);
                        }
                    } else {
                        r = 3;
                        1 == n ? r = 1 : 1 == a && (r = 4);
                        for (i = 0; i < r; i++) this._standup_tiles.pop();
                    }
                    this._gang_tiles.push(e.gang);
                } else this._drop_tiles.pop(), Global.notificationCenter.emit(Global.eventName.GAME_REFRESH_ARROW, -1);
            },
            win: function (e) {
                this._isWin = !0, this._win_tiles = e.tilesInfo.win_tiles, this._multiWinTiles = e.multiWinTiles,
                    e.winMode == Global.config.winMode.GangKai || e.winMode == Global.config.winMode.ZiMo ? (this._standup_tiles.pop(),
                    e.reconnect || o.playWinBySelfSound(this._sex)) : e.reconnect || o.playWinSound(this._sex);
            },
            lose: function (e) {
                e.winMode < 0 && e.winMode != Global.config.winMode.Lose && (this._drop_tiles.pop(),
                    Global.notificationCenter.emit(Global.eventName.GAME_REFRESH_ARROW, -1));
            },
            detailInfo: function (e) {
                this._detailInfo = e.detailDescList;
            },
            getDetailInfo: function () {
                return this._detailInfo;
            },
            isWin: function () {
                return this._isWin;
            },
            isLose: function () {
                return this.getState() == Global.config.playState.CONFIRM_LOOSE;
            },
            delTiles: function (e) {
                for (var t = 0; t < e.length; t++) {
                    var n = this._standup_tiles.indexOf(e[t]);
                    n >= 0 && this._standup_tiles.splice(n, 1);
                }
                this._standup_tiles.sort(this._sortFun.bind(this));
            },
            getDoubleWinCount: function () {
                var e = 5, t = Global.configCdn.getUISwitchConf();
                return t && (e = (e = t.MAX_SHARE_COUNT) > 0 ? e : 5), console.log("getDoubleWinCount: count= ", e),
                e - this._winDoubleCount;
            },
            getLosePaybackCount: function () {
                var e = 5, t = Global.configCdn.getUISwitchConf();
                return t && (e = (e = t.MAX_SHARE_COUNT) > 0 ? e : 5), console.log("getLosePaybackCount: count= ", e),
                e - this._losePayBackCount;
            },
            getDoubleWinByAD: function () {
                var e = Global.configCdn.getUISwitchConf();
                if (!e) return !0;
                var t = e.videoGetRewardNum;
                Global.utils.isThisCityBlocked() && (t = e.videoForCityNum);
                var n = e.MAX_SHARE_COUNT - t;
                return e.MAX_SHARE_COUNT - this._winDoubleCount > n;
            },
            getLosePayBackByAD: function () {
                var e = Global.configCdn.getUISwitchConf();
                if (!e) return !0;
                var t = e.videoGetRewardNum;
                Global.utils.isThisCityBlocked() && (t = e.videoForCityNum);
                var n = e.MAX_SHARE_COUNT - t;
                return e.MAX_SHARE_COUNT - this._losePayBackCount > n;
            },
            getSeatId: function () {
                return this._seatId;
            },
            getUserId: function () {
                return this._uesrId;
            },
            getSex: function () {
                return this._sex;
            },
            getState: function () {
                return this._state;
            },
            getIsTing: function () {
                return this._ting;
            },
            setIsTing: function (e) {
                this._ting = e;
            },
            getIsTingSelect: function () {
                return this._tingSelect;
            },
            setIsTingSelect: function (e) {
                console.log("setIsTingSelect this:", this._seatId, e), this._tingSelect = e;
            }
        },  module.exports = i
    }